Carbon


CollectionFlattenProcPtr

Header: Collections.h Carbon status: Supported

Defines a pointer to a flattening callback function. Your flattening callback function reads or writes flattened collection data.

typedef OSErr(* CollectionFlattenProcPtr) (
    SInt32 size, 
    void *data, 
    void *refCon
);

You would declare your function like this if you were to name it MyCollectionFlattenCallback:

OSErr MyCollectionFlattenCallback (
    SInt32 size, 
    void *data, 
    void *refCon
);
size

The size of the block of flattened data to read or write.Your function should read or copy the requested number of bytes of flattened data into the block of memory pointed to by the data parameter.

data

A pointer to the block of flattened data. When flattening, this pointer points to the data your callback function should write. When unflattening, your callback function should read flattened data into the memory pointed to by this parameter.

refCon

A value you provide to the FlattenCollection function or UnflattenCollection function that the Collection Manager passes on to your callback function. You can use this parameter as a pointer to a structure containing relevant state information you need when reading or writing the flattened data.

function result

A result code. If the execution of this function results in any fatal error, you should return the error code back to the Collection Manager as the function result. If the function executes successfully, you should return the noErr error code as the function result.

DISCUSSION

You create this function to pass to the FlattenCollection, FlattenPartialCollection, and UnflattenCollection functions when flattening or unflattening a collection.

As the Collection Manager is flattening a collection, it repeatedly calls this callback function to process sequential blocks of flattened data. Each time it calls this function, it provides a pointer to the current block of flattened data in the data parameter and the size of the current block in the size parameter. You can process this data in a number of ways: appending it to a handle-based block of memory, writing it to disk, and so on.

When unflattening a collection, the Collection Manager repeatedly calls this function to obtain blocks of flattened data.

AVAILABILITY

Supported in Carbon.


© 2000 Apple Computer, Inc. — (Last Updated 5/8/2000)